#include "Ball.h"
#include "GL.h"
#include "GL/glut.h"

Ball::Ball(Point center, double radius) : center(center), speed(0.0, 0.0, 0.0),
										  material(), radius(radius) {
}

Ball::~Ball() {
}

void Ball::update() {
}

void Ball::setCenter(const Point &center) {
    this->center.set(center);
}

Point Ball::getCenter() const {
    return this->center;
}

bool Ball::isColliding(Ball &other) {
    const double combinedRadius = this->radius + other.radius;
    return this->center.subtract(other.center).squareLenght() <= (combinedRadius * combinedRadius);
}

void Ball::render() {
	GL::translate(this->center);
	glutWireSphere(this->radius, 16, 16);
}
